package cn.iocoder.yudao.module.mqtt.dal.mysql.subscribewater;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.mqtt.dal.dataobject.subscribewater.SubscribeWaterDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.mqtt.controller.admin.subscribewater.vo.*;

/**
 * MQTT水监控 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface SubscribeWaterMapper extends BaseMapperX<SubscribeWaterDO> {

    default PageResult<SubscribeWaterDO> selectPage(SubscribeWaterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SubscribeWaterDO>()
                .eqIfPresent(SubscribeWaterDO::getDeviceKey, reqVO.getDeviceKey())
                .eqIfPresent(SubscribeWaterDO::getMqttConfigId, reqVO.getMqttConfigId())
                .eqIfPresent(SubscribeWaterDO::getTopic, reqVO.getTopic())
                .eqIfPresent(SubscribeWaterDO::getPayloadWd, reqVO.getPayloadWd())
                .eqIfPresent(SubscribeWaterDO::getPayloadZd, reqVO.getPayloadZd())
                .eqIfPresent(SubscribeWaterDO::getPayloadYl, reqVO.getPayloadYl())
                .eqIfPresent(SubscribeWaterDO::getPayloadPh, reqVO.getPayloadPh())
                .eqIfPresent(SubscribeWaterDO::getPayload, reqVO.getPayload())
                .eqIfPresent(SubscribeWaterDO::getQos, reqVO.getQos())
                .eqIfPresent(SubscribeWaterDO::getRetained, reqVO.getRetained())
                .eqIfPresent(SubscribeWaterDO::getDirection, reqVO.getDirection())
                .eqIfPresent(SubscribeWaterDO::getClientId, reqVO.getClientId())
                .eqIfPresent(SubscribeWaterDO::getMessageId, reqVO.getMessageId())
                .eqIfPresent(SubscribeWaterDO::getTimestamp, reqVO.getTimestamp())
                .betweenIfPresent(SubscribeWaterDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(SubscribeWaterDO::getDeviceKey, reqVO.getDeviceKeys())
                .orderByDesc(SubscribeWaterDO::getCreateTime));
    }


}